﻿@using HotelMgr.Models
@using Telerik.Web.Mvc.UI
@model IEnumerable<HotelMgr.Models.Room>

@{
    ViewBag.Title = "Index";
}

<h3 style="text-align: center;font-size: 20px;font-weight: bolder;">房间管理</h3>

<p style="font-size: 18px;font-weight: bolder;">
    @Html.ActionLink("添加房间", "Create")
</p>
@(Html.Telerik().Grid(Model)
.Name("RoomGrid")
.DataKeys(key=>key.Add(k=>k.RoomID))
.ToolBar(c=>c.Insert().ButtonType(GridButtonType.Image))
.DataBinding(b=>b.Server()
    .Select("Select", "RoomManager")
    .Insert("Insert", "RoomManager")
    .Update("Save", "RoomManager")
    .Delete("Delete", "RoomManager")
    )
.Columns(r=>
             {
                 r.Bound(i => i.RoomID);
                 r.Bound(i=>i.RoomType.TypeName);
                 r.Bound(i => i.RoomPrice);
                 r.Bound(i => i.RoomState.Name);
                 r.Bound(i => i.RoomUrl);
                 //r.Bound(i => i.Price);
                 @*r.Template(@<text>
                                 @Html.ActionLink("修改", "Edit", new {id = item.RoomID},null) |
                                 @Html.ActionLink("详细", "Details", new {id = item.RoomID},null) |
                                 @Html.ActionLink("删除", "Delete", new {id = item.RoomID},null)
                             </text>).Title("操作");*@
                 r.Command(c =>
                               {
                                   c.Edit().ButtonType(GridButtonType.Image);
                                   c.Delete().ButtonType(GridButtonType.Image);
                               }).Title("操作");
             })
             .Editable(e=>e.Mode(GridEditMode.InLine))
             .Pageable()
             .Scrollable(s => s.Enabled(true))
             .Footer(true))


                                     